#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
ll p, q, n, s;

//TLE版本
int main() {
    n = 2000000;

    for (p = 1; p <= n / 2; p++)
        for (q = p + 1; q < n; q++) {
            s = (p + q) * (q - p + 1) / 2;
            if (s == n) {
                cout << p << " " << q << endl;
            }
        }
}
